<template>
	<view class="page">
		<u-navbar title="浏览用户" border @leftClick="$utils.back()" placeholder>
		</u-navbar>
		<filter @reload='reload' />
		<view style="flex: 1;margin-top: 20rpx;">
			<z-paging ref="paging" style="height: 100%;" :fixed="false" v-model="data" @query="query"
				:default-page-no="1" :default-page-size="10">
				<template v-if="!loading">
					<view class="userInfoBox" v-for="item in data" :key="item.id">
						<u--image :fade='false' :src="item.user.avatar" width="100rpx" height="100rpx"
							radius='8rpx'></u--image>
						<view>
							<view class="flex">
								<u-text :lines='1' size='24rpx' :text='item.user.nick_name'></u-text>
							
							</view>
							<view>
								<u-text :lines='1' size='24rpx' :text='item.user.mobile'></u-text>
							</view>
						</view>
					</view>
				</template>
				<template v-else>
					<view class="userInfoBox" v-for="item in 20" :key="item">
						<view style="height: 100rpx;width: 100rpx;border-radius: 8rpx;" class="Skeleton" />
						<view>
							<view style="height: 30rpx;" class="Skeleton" />
							<view style="height: 30rpx;" class="Skeleton" />
						</view>
					</view>
				</template>
			
			</z-paging>
		</view>
	</view>
</template>

<script>
	import filter from '@/components_company/filter.vue'
	export default {
		components: {
			filter
		},
		data() {
			return {
				data: [],
				loading: true,
				keywords: null
			}
		},
		methods: {
			reload(e) {
				this.keywords = e.keywords
				this.$refs.paging.reload()
			},
		
			query(page, size) {
				let obj = {
					keywords: this.keywords,
					page,
					size
				}
				uni.showLoading({
					title: '加载中...'
				})
				this.$api_company.Members.List(obj).then(res => {
					this.$refs.paging.complete(res.data.members.data)
					this.loading = false
					uni.hideLoading()
				}).catch(err => {
					console.log(err)
					uni.hideLoading()
				})
			},
		
		
		
			
		}
	}
</script>

<style lang="scss">
	.page {
		padding: 0rpx 20rpx;
		height: 100vh;
		padding-bottom: calc(constant(safe-area-inset-bottom) + 10rpx);
		/* 兼容 iOS 设备 */
		padding-bottom: calc(env(safe-area-inset-bottom) + 10rpx);
		box-sizing: border-box;
		display: flex;
		flex-direction: column;

		.userInfoBox {
			display: flex;
			margin-bottom: 20rpx;

			>view:nth-child(2) {
				margin-left: 10px;
				flex: 1;
				display: flex;
				height: 100rpx;
				flex-direction: column;
				justify-content: space-between;
				border-bottom: 1rpx solid #f1f1f1;
				padding: 0 0 10rpx 0;
			}
		}

	
	}

	.flex {
		display: flex;
	}
</style>